﻿using System;
using System.Collections.Generic;
using System.Xml.Serialization;

namespace LdtJudge.DataEngine.Model.XMLConfigModel.OptimizeConfigModel.StagOptimization
{
    /// <summary>
    /// 阶段性配置文件读取
    /// </summary>
    [Serializable]
    [XmlRootAttribute("root", IsNullable = false)]
    public class StagConfigModel
    {
        private List<StagConfigSetp> _stagConfigsList = new List<StagConfigSetp>();

        /// <summary>
        /// 阶段节点集合
        /// </summary>
        [XmlElementAttribute("step", IsNullable = false)]
        public List<StagConfigSetp> stagConfigList
        {
            get { return _stagConfigsList; }
            set { _stagConfigsList = value; }
        }
    }

    /// <summary>
    /// 阶段信息配置读取
    /// </summary>
    public class StagConfigSetp
    {
        /// <summary>
        /// 当前阶段序号
        /// </summary>
        [XmlAttribute("number")]
        public string Number { get; set; }

        /// <summary>
        /// 当前阶段编号
        /// </summary>
        [XmlAttribute("stage")]
        public string Stage { get; set; }

        /// <summary>
        /// 当前阶段名称
        /// </summary>
        [XmlAttribute("name")]
        public string Name { get; set; }

        /// <summary>
        /// 节点集合
        /// </summary>
        private List<XmlNodeData> _xmlNodeDatas = new List<XmlNodeData>();
       
        /// <summary>
        /// 节点信息集合
        /// </summary>
        [XmlElementAttribute("xmlNodedata", IsNullable = false)]
        public List<XmlNodeData> xmlNodeList
        {
            get { return _xmlNodeDatas; }
            set { _xmlNodeDatas = value; }
        }
    }

    /// <summary>
    /// 节点信息读取
    /// </summary>
    public class XmlNodeData
    {
        /// <summary>
        /// 通用模板节点
        /// </summary>
        [XmlAttribute("TemplateXpath")]
        public string TemplateXpath { get; set; }

        /// <summary>
        /// 实际结果节点
        /// </summary>
        [XmlAttribute("DataXmlpath")]
        public string DataXmlpath { get; set; }

        /// <summary>
        /// 节点集合
        /// </summary>
        private List<XmlNodeData> _xmlNodeDatas = new List<XmlNodeData>();

        /// <summary>
        /// 节点信息集合
        /// </summary>
        [XmlElementAttribute("xmlNodedata", IsNullable = false)]
        public List<XmlNodeData> xmlNodeList
        {
            get { return _xmlNodeDatas; }
            set { _xmlNodeDatas = value; }
        }

        private List<XmlNodeAttribute> _xmlNodeAttributeList = new List<XmlNodeAttribute>();

        /// <summary>
        /// 属性集合
        /// </summary>
        [XmlElementAttribute("xmlattribute", IsNullable = false)]
        public List<XmlNodeAttribute> xmlNodeAttributeList 
        {
            get { return _xmlNodeAttributeList; }
            set { _xmlNodeAttributeList = value; }
        }
    }
    /// <summary>
    /// 属性信息读取
    /// </summary>
    public class XmlNodeAttribute
    {
        /// <summary>
        /// 通用模板属性名称
        /// </summary>
        [XmlAttribute("TemplateName")]
        public string TemplateName { get; set; }

        /// <summary>
        /// 结果数据属性名称
        /// </summary>
        [XmlAttribute("DataName")]
        public string DataName { get; set; }
    }
}
